import request from "@/utils/request";

const mock = "https://m1.apifoxmock.com/m1/7176471-6900810-default";

// 项目动态查询参数接口
export interface ActivitySearchRequest {
  projectId: string;
  pageNo: number;
  pageSize: number;
}

// 项目动态项接口
export interface ProjectActivity {
  id: string;
  projectId: string;
  userId: string;
  userName: string;
  avatar?: string;
  content: string;
  activityType: string;
  createTime: string;
  tags?: string[];
}

// 分页结果接口
export interface PageResultActivity {
  result: ProjectActivity[];
  total: number;
  pageNo: number;
  pageSize: number;
}

// 获取项目动态列表
export const getProjectActivities = (params: ActivitySearchRequest) => {
  return request<PageResultActivity>({
    url: `${mock}/project/activity/list`,
    method: "post",
    data: params,
  });
};

// 添加项目动态
export const addProjectActivity = (data: {
  projectId: string;
  content: string;
  activityType: string;
  tags?: string[];
}) => {
  return request({
    url: `${mock}/project/activity/add`,
    method: "post",
    data,
  });
};
